<?php
$dis_id=3;
include("../../inc/conn.inc");
include("../islogin2.php");
    if($per_row["m_type"]=="3")
    {
        checkCount("jd_fangdai");
    }

if($_POST[act_tj]){
	    $c_rs=@mysql_query("select * from city where id='$_POST[c_provinces]' and city_id=0");
		$c_row=@mysql_fetch_array($c_rs);
		$c_rs2=@mysql_query("select * from city where id='$_POST[c_city]' and city_id>0");
		$c_row2=@mysql_fetch_array($c_rs2);
		$c_rs3=@mysql_query("select * from city where id='$_POST[c_diqu]' and city_id>0");
		$c_row3=@mysql_fetch_array($c_rs3);
		$c_provinces=($_POST[c_provinces])?$_POST[c_provinces]:0;
		$c_city=($_POST[c_city])?$_POST[c_city]:0;
		$c_diqu=($_POST[c_diqu])?$_POST[c_diqu]:0;
	    
		
		$f_zhouqi=$_POST[f_zhouqi1]."@".$_POST[f_zhouqi2];
		$f_lilv=$_POST[f_lilv1]."%".$_POST[f_lilv2];
		

	    @mysql_query("insert into jd_fangdai (member_id,fd_title,fd_jiner,fd_duixiang,fd_zhouqi,fd_shenpi,fd_lilv,fd_pro_id,fd_pro,fd_city_id,fd_city,fd_diqu_id,fd_diqu,fd_danbao,fd_shuoming,addtime) values ('".$_COOKIE['user_id']."','$_POST[f_title]','$_POST[f_jiner]','$_POST[f_duixiang]','$f_zhouqi','$_POST[f_shenpi]','$f_lilv','$c_provinces','$c_row[city_name]','$c_city','$c_row2[city_name]','$c_diqu','$c_row3[city_name]','$_POST[f_danbao]','$_POST[f_shuoming]','".date("Y-m-d H:i:s")."')");
		
		
		$check_rs=@mysql_query("select id,jd_is from member where id='".$_COOKIE['user_id']."'");
        $check_row=@mysql_fetch_array($check_rs);
		if(!$check_row[jd_is]){
		  @mysql_query("update member set jd_is='1' where id='$check_row[id]'");
		}
        
	    echo "<script>alert('添加成功');location='index.php';</script>";		 


}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>会员中心-三帝贸易网</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<script type="text/javascript" src="../js/left.js" charset="gb2312"></script>
<script type="text/javascript" src="/js/city.js" charset="gb2312"></script>
<body>
<div id="mian">
<?php include("../inc/top.php");?>
<div class="top1"><span>您当前位置：<a href="../index.php" class="dh">会员助手</a> &gt;&gt; 供应信息 &gt;&gt; 发布放贷</span></div>
<div class="left">
<?php include("../inc/left.php");?>
</div>
<div class="right">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
   <TR>
     <TD height="40" bgcolor="#EFF6FF" style="font-size:18px;font-weight:bold;padding-left:8px;">发布放贷</TD>
   </TR>
</TABLE>
<div style="padding-left:10px; padding-right:10px; line-height:25px;">会员您好！请您在发布借贷信息前请在【企业商铺管理】里《会员认证》上传经营范围含有关《借贷》项目的有效年检后的营业执照。</div>
<TABLE cellSpacing=1 cellPadding=5 width="100%" bgColor=#c1dcf5 border=0>
  <TBODY>
  <FORM name="form1" onSubmit="return checkform()" action="" method="post">
  <TR>
    <TD align=middle width="17%" bgColor=#eff6ff>放贷标题：<FONT color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT: 4px" width="83%" bgColor=#f9f9f9><INPUT id="f_title" maxLength="250" size="50" name="f_title"></TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>贷款金额：<FONT color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT: 4px;" bgColor=#f9f9f9>
	<select name="f_jiner">
	  <option value="">选择贷款金额</option>
	  <option value="50">50万以下</option>
	  <option value="50-100">50-100万</option>
	  <option value="100-200">100-200万</option>
	  <option value="200-400">200-400万</option>
	  <option value="400-600">400-600万</option>
	  <option value="600-800">600-800万</option>
	  <option value="800-1000">800-1000万</option>
	  <option value="1000">1000万以上</option>
	</select></TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>贷款对象：<FONT color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT: 4px" bgColor=#f9f9f9>
	<select id="f_duixiang" name="f_duixiang">
	  <option value="">选择贷款对象</option>
      <option value="个人">个人</option>
      <option value="企业">企业</option>
      <option value="个人及企业">个人及企业</option>
     </select></TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>贷款周期：<FONT color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT:4px;" bgColor=#f9f9f9><input name="f_zhouqi1" type="text" id="f_zhouqi1" value="0" size="5" maxlength="20" />
	 <select id="f_zhouqi2" name="f_zhouqi2">
        <option value="年">年</option>
        <option value="月">月</option>
      </select>
	 &nbsp;&nbsp;<FONT color=#ff0000>0表示“商谈”</FONT></TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>贷款利率：<FONT  color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT: 4px" bgColor=#f9f9f9><input name="f_lilv1" type="text" id="f_lilv1" value="0" size="5" maxlength="10" /> 
    %
    <select id="f_lilv2" name="f_lilv2">
      <option>年</option>
      <option>月</option>
    </select> &nbsp;<FONT color=#ff0000>0表示“商谈”</FONT></TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>审批时间：<FONT color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT: 4px" bgColor=#f9f9f9><INPUT name="f_shenpi" id="f_shenpi" size="10" maxlength="20"> 
    天</TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>货款地区：<FONT color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT: 4px" bgColor=#f9f9f9><select  name="c_provinces" id="c_provinces" onChange="changecity(document.form1.c_provinces.options[document.form1.c_provinces.selectedIndex].value)">
            <option value="">--选择省份--</option>
          <?php
          $result = mysql_query("select * from city where city_id=0");    
          while($res = mysql_fetch_array($result)){    
          ?>    
          <option value="<?=$res['id']?>"><?=$res['city_name']?></option> 
          <?php }?>   
       </select>
       <select name="c_city" id="c_city" onChange="changecity2(document.form1.c_city.options[document.form1.c_city.selectedIndex].value)">
            <option value="">--选择城市--</option>
       </select>
	   <select name="c_diqu" id="c_diqu">
            <option value="">--选择地区--</option>
       </select></TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>担保方式：<FONT color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT: 4px" bgColor=#f9f9f9><INPUT id="f_danbao" maxLength="200" size="70" name="f_danbao"></TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>贷款说明：<FONT color=#ff0000>*</FONT></TD>
    <TD style="PADDING-LEFT: 4px" bgColor=#f9f9f9><textarea id="f_shuoming" name="f_shuoming" cols="70" rows="20"></textarea></TD>
  </TR>
  <TR>
    <TD align=middle bgColor=#eff6ff>&nbsp;</TD><input type="hidden" name="act_tj" value="ok">
    <TD style="PADDING-LEFT: 4px" bgColor=#f9f9f9><input name="submit" type="submit" value="提交"></TD>
  </TR>
  </FORM>
</TABLE>
</div>
<div class="onl"></div>
<?php include("../inc/foot.php");?>

</div>
</body>
</html>
<script language="javascript">
function $(id){
return document.getElementById(id);
}
function checkform(){
   if($("f_title").value==""){
      alert("放贷标题不能为空");
      $("f_title").focus();
      return false;
   }
   if($("f_jiner").value==""){
      alert("选择贷款金额");
      $("f_jiner").focus();
      return false;
   }   

   if($("f_duixiang").value==""){
      alert("选择贷款对象");
      $("f_duixiang").focus();
      return false;
   }      
   if($("f_zhouqi1").value==""){
      alert("贷款周期不能为空");
      $("f_zhouqi1").focus();
      return false;
   }
   if($("f_zhouqi2").value==""){
      alert("选择贷款周期参数");
      $("f_zhouqi2").focus();
      return false;
   }
   if($("f_lilv1").value==""){
      alert("贷款利率不能为空");
      $("f_lilv1").focus();
      return false;
   }
   if($("f_shenpi").value==""){
      alert("贷款审批时间不能为空");
      $("f_shenpi").focus();
      return false;
   }
   if($("c_provinces").value==""){
      alert("请选择省份");
      $("c_provinces").focus();
      return false;
   }
   if($("c_city").value==""){
      alert("请选择城市");
      $("c_city").focus();
      return false;
   }
  

   if($("f_danbao").value==""){
      alert("担保方式不能为空");
      $("f_danbao").focus();
      return false;
   }   
   if($("f_shuoming").value==""){
      alert("贷款说明不能为空");
      $("f_shuoming").focus();
      return false;
   }   
}
</script>
